package  org.fantasy.common.util;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import net.sf.json.JSONObject;

public class JSONUtil {
    public static Map toMap(String jsonString) {
	JSONObject jsonObject = JSONObject.fromObject(jsonString);
	Iterator keyIter = jsonObject.keys();
	String key;
	Object value;
	Map valueMap = new HashMap();
	while (keyIter.hasNext()) {
	    key = (String) keyIter.next();
	    value = jsonObject.get(key);
	    valueMap.put(key, value);
	}
	return valueMap;
    }
}
